package com.epam.tags;

import java.io.IOException;

import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

import org.apache.log4j.Logger;

import com.epam.entity.Hotel;

public class HotelTagHandler extends TagSupport {

	private static Logger LOG = Logger.getLogger(HotelTagHandler.class);
	private static final long serialVersionUID = 1L;
	private Hotel hotel;
	
	
	public int doStartTag() {
		
		JspWriter out = pageContext.getOut();
		
		try {    
			out.println("<tr>");
			out.println("<td>" + hotel.getHotelId() + "</td>");
			out.println("<td>" + hotel.getName() + "</td>");
			out.println("<td>" + hotel.getStars() + "</td>");
			out.println("<td>" + hotel.isTv() + "</td>");
			out.println("<td>" + hotel.isConditioning() + "</td>");
			out.println("<td>" + hotel.getFeeding() + "</td>");
			out.println("</tr>");
			
			
		} catch (IOException e) {
			LOG.error(e);
		}
		
		
		
		return SKIP_BODY;
		
	}


	public Hotel getHotel() {
		return hotel;
	}


	public void setHotel(Hotel hotel) {
		this.hotel = hotel;
	}
	
}
